package com.atguigu.gulimall.member.web;

import com.alibaba.fastjson.JSON;
import com.atguigu.common.utils.R;
import com.atguigu.gulimall.member.feign.OrderFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.HashMap;
import java.util.Map;

@Controller
public class MyWebController {

    @Autowired
    private OrderFeign orderFeign;

    //http://xn--55q73lnb773bp41bqvgouw5ts/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp?
    // charset=utf-8&out_trade_no=202209162000023421570744314898161665
    // &method=alipay.trade.page.pay.return&total_amount=65055.00
    // &sign=c%2B6oohXQYNoDBd6aMzkqu8nirtONSB4rsmRdCe8B1vgQJI4CQ%2Fg9SdcTBs92efz2%2BoEOy7eAnJH5UP1WeIzl%2FTk9g9gYv0y1KvLvmXGOuhzaee%2BuhM8zoV57aSQn7sUhWTPiR5KAxSgTQr8MjBc3cR7%2FiCc%2Fj13naqBSZb0IBV9IlvDcBoIHlwDs%2BXbBrgR8HCzKUX%2BmucbtjL1nsYesB92izJVqtshGPGR9DmSLQNkwU54fqUJx7INnASH9KgCyzPw%2FgrLg0%2F2sCT20KuUlNli84xLftOf7kZOSEbYUQYLK6%2B3fdqkVOmRdBYp5u2TRhn9fA4E%2FzIRL9PxpOMmO9A%3D%3D
    // &trade_no=2022091622001407280506721575
    // &auth_app_id=2021000121664287
    // &version=1.0
    // &app_id=2021000121664287&sign_type=RSA2&seller_id=2088621993158615
    // &timestamp=2022-09-16+20%3A00%3A47
    @GetMapping("/memberOrder.html")
    public String memberOrder(Model model){
        Map<String, Object> map = new HashMap<>();
        map.put("limit","5");
        R r = orderFeign.getOrderAndOrderItemList(map);
        System.out.println(JSON.toJSONString(r));
        model.addAttribute("orders",r);
        return "orderList";
    }
}
